<script lang="ts" setup>
import {debounce} from "@/util/FunctionUtil.ts";

const {
    title,
    type,
    auth
} = defineProps<{
    title: string
    type: "success" | "warning" | "danger" | "primary" | "info" | "text"
    auth:string
}>()

const emit = defineEmits(["click"])

function click() {
    debounce(
        () => emit("click")
        , 500)
}
</script>

<template>
    <el-button @click="click"
               v-if="type == 'success'"
               type="success"
               color="#36b8a7"
               style="color: white"
               v-auth="auth"
    >
        {{ title }}
    </el-button>
    <el-button
            v-else
            :type="type"
            @click="click"
            v-auth="auth"
    >
        {{ title }}
    </el-button>
</template>

<style scoped>

</style>